﻿using System;
using System.Collections.Generic;

namespace WebCrawler
{
    public class Vertex
    {
        public IHTMLDoc doc;
        public IList<Edge> edges;
        public bool mark;
        public String title;
        public String url;

        public Vertex(String url)
        {
            this.url = url;
            this.doc = new HtmlDocRegEx(url);
            mark = false;
            edges = new List<Edge>();
        }

        public IHTMLDoc Doc
        {
            get { return doc; }
            set { doc = value; }
        }

        public IList<Edge> Edges
        {
            get { return edges; }
            set { edges = value; }
        }

        public bool Mark
        {
            get { return mark; }
            set { mark = value; }
        }

        public string Title
        {
            get { return Doc.Title; }
        }

        public string Url
        {
            get { return url; }
            set { url = value; }
        }

        public void AddEdge(Vertex to)
        {
            Edges.Add(new Edge(this, to));
        }

        public int NoOfEdgesFromVertex()
        {
            int noOfEdges = Edges.Count;
            return noOfEdges;
        }

        public void RemoveEdge(Edge edge)
        {
            Edges.Remove(edge);
        }
    }
}